#include <iostream>
#include <vector>
#include <string>

using namespace std;

int process(int &x, int &y, string &str)
{
    vector<string> steps;
    int wordLen = 0;
    //分离字符串，在steps中存放了以 ";" 为间隔的各个单词
    for (int i = 0; i < str.size(); ++i)
    {
        while (str[i] != ';')
        {
            wordLen++;
            i++;
        }
        steps.push_back(str.substr(i - wordLen, wordLen));
        wordLen = 0;
    }
    //对单个step执行坐标变换
    for (int i = 0; i < steps.size(); ++i)
    {
        int num = 0;
        if (steps[i].length() == 3)
        {
            if (steps[i][1] <= '9' && steps[i][1] >= '0' && steps[i][2] >= '0' && steps[i][2] <= '9')
            {
                num = (steps[i][1] - '0') * 10 + (steps[i][2] - '0');
            }
        }
        else if (steps[i].length() == 2)
        {
            if (steps[i][1] >= '0' && steps[i][1] <= '9')
            {
                num = (steps[i][1] - '0');
            }
        }
        switch (steps[i][0])
        {
        case 'A':
            x -= num;
            break;
        case 'W':
            y += num;
            break;
        case 'S':
            y -= num;
            break;
        case 'D':
            x += num;
            break;
        default:
            break;
        }
    }
    return 0;
}

int main()
{
    string str;

    while (cin >> str)
    {
        int x = 0, y = 0;
        process(x, y, str);
        cout << x << "," << y << endl;
    }
    return 0;
}